﻿using System;
using StockTrader.BusinessService.DataContract;
using StockTrader.DAL.HastcAdapter.FileParser.Structure;
using System.Collections.Generic;
using StockTrader.BusinessService.DataContract.Hastc;

namespace StockTrader.DAL.IDAL
{
    public interface IStsStocks
    {
        void BeginADOTransaction();
        void RollBackTransaction();
        void CommitADOTransaction();
        void Open(string connString);
        void Close();

        int CountSTS_STOCKSINFO();
        void DeleteSTS_STOCKSINFO();
        void InsertSTS_STOCKSINFO(STS_STOCKSINFO item);
        void UpdateSTS_STOCKSINFO(STS_STOCKSINFO item);

        int CountSTS_MARKETINFO();
        int CountSTS_MARKETINFO_BYTIME(string time);
        void DeleteSTS_MARKETINFO();
        void InsertSTS_MARKETINFO(STS_MARKETINFO item);
        void UpdateSTS_MARKETINFO(STS_MARKETINFO item);

        int CountSTS_TOP3_PRICE_A();
        void DeleteSTS_TOP3_PRICE_A();
        void InsertSTS_TOP3_PRICE_A(STS_TOP3_PRICE_A item);
        void UpdateSTS_TOP3_PRICE_A(STS_TOP3_PRICE_A item);

        int CountSTS_TOP3_PRICE_B();
        void DeleteSTS_TOP3_PRICE_B();
        void InsertSTS_TOP3_PRICE_B(STS_TOP3_PRICE_B item);
        void UpdateSTS_TOP3_PRICE_B(STS_TOP3_PRICE_B item);

        int CountSTS_ORDERS();
        void DeleteSTS_ORDERS();
        void InsertSTS_ORDERS(STS_ORDERS item);
        void UpdateSTS_ORDERS(STS_ORDERS item);

        int CountSTS_TRADING_RESULT();
        void DeleteSTS_TRADING_RESULT();
        void InsertSTS_TRADING_RESULT(STS_TRADING_RESULT item);
        void UpdateSTS_TRADING_RESULT(STS_TRADING_RESULT item);

        int CountSTS_LE_ByCode(string code, decimal totalqtty);
        int CountSTS_LE();
        void DeleteSTS_LE();
        void InsertSTS_LE(DateTime time, string code, decimal stockid, decimal price, decimal quantity, decimal high, decimal low, decimal total);

        void BackupHastc();
        void ClearHastc();

        void UpdateSecuritiesInfo(int stockno, string symbol, string market);

        #region Get STS_info
        List<STSORDERS> getSTS_ORDERS();
        List<STSTRADING_RESULT> getSTS_TRADING_RESULT();
        List<SecuritiesInfo> getSTOCKSINFO();
        List<STSTOP3_PRICE_A> getSTS_TOP3_PRICE_A();
        List<STSTOP3_PRICE_B> getSTS_TOP3_PRICE_B();
        List<STSMARKETINFO> getSTS_MARKETINFO();
        #endregion

        #region Get STS_info Backup
        List<STSORDERS> getSTS_ORDERSBackup(DateTime from, DateTime to);
        List<STSTRADING_RESULT> getSTS_TRADING_RESULTBackup(DateTime from, DateTime to);
        List<SecuritiesInfo> getSTOCKSINFOBackup(DateTime from, DateTime to);
        List<STSTOP3_PRICE_A> getSTS_TOP3_PRICE_ABackup(DateTime from, DateTime to);
        List<STSTOP3_PRICE_B> getSTS_TOP3_PRICE_BBackup(DateTime from, DateTime to);
        List<STSMARKETINFO> getSTS_MARKETINFOBackup(DateTime from, DateTime to);
        #endregion


    }
}
